//
//  DoctorApplyModel.m
//  International_Hospital
//
//  Created by 统杰李 on 16/7/6.
//  Copyright © 2016年 LiYiLin. All rights reserved.
//

#import "DoctorApplyModel.h"

#import "NetWorkTool.h"

@implementation DoctorApplyModel

+ (instancetype)modelWithDict:(NSDictionary *)dict{
    
    DoctorApplyModel *model = [[DoctorApplyModel alloc] init];
    
    [model setValuesForKeysWithDictionary:dict];
    
    return model;
    
}

+ (void)getDataWithSuccess:(void (^)(NSArray *array))successBlock error:(void (^)())errorBlock {
    
    NSString *urlString = @"http://iosapi.itcast.cn/matchDoctors.json.php";

    NSDictionary *paramDic = @{@"ci1_id":@1,
                               @"ci2_id":@3,
                               @"ci3_id":@3,
                               @"diagnosis_type":@0,
                               @"page_size":@15,
                               @"is_confirmed":@1,
                               @"user_id":@1000089,
                               @"page":@1,
                               @"has_diagnosis":@2
                               };
    
    [[NetWorkTool shareManager] POST_RequestWithUrlString:urlString parmas:paramDic successBloock:^(NSDictionary * responseObject) {
        
        NSArray *dicts = responseObject[@"data"];

        NSMutableArray *tempArray = [NSMutableArray array];
        
        for (NSDictionary *dict in dicts) {
            
            DoctorApplyModel *model = [DoctorApplyModel modelWithDict:dict];
            
            [tempArray addObject:model];
            
        }
        
        if (successBlock) {
            successBlock(tempArray.copy);
        }
        
        
    } failureBlock:^(NSError *error) {
        
        if (errorBlock) {
            errorBlock();
        }
        
    }];
    
    
}

//防止kvc出错
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end
